package com.bw.zg3_day05zy.user

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope
import com.bw.base.entity.UserBean
import com.bw.base.mvvm.BaseViewModel
import com.bw.base.net.ApiService
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.launch
import javax.inject.Inject

@HiltViewModel
class UserViewModel @Inject constructor(val apiService: ApiService): BaseViewModel() {
    val loginData = MutableLiveData<UserBean>()
    fun login(password: String, username:String){
        viewModelScope.launch {
            httpRequest({apiService.login(password, username)},loginData::postValue)
        }
    }
}